package com.example.communitypro.controller;

import com.example.communitypro.pojo.CommunityManagement;
import com.example.communitypro.pojo.UserActions;
import com.example.communitypro.service.CommunityManagementService;
import com.example.communitypro.util.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/communityManagement")
@CrossOrigin
public class CommunityManagementController {

    @Autowired
    private CommunityManagementService communityManagementService;

    @RequestMapping(value = "/addCommunityManagement")
    public Result addCommunityManagement(CommunityManagement record){
        return communityManagementService.addCommunityManagement(record);
    }


    @RequestMapping(value = "/dropCommunityManagement")
    public Result dropCommunityManagement(Integer managementNo){
        return communityManagementService.dropCommunityManagementByPrimaryKey(managementNo);
    }

    @RequestMapping(value = "/dropCommunityManagementByUserAndCommunity")
    public Result dropCommunityManagementByUserAndCommunity(Integer userNO,Integer communityNo){
        return communityManagementService.dropCommunityManagementByUserAndCommunity(userNO,communityNo);
    }

    @RequestMapping(value = "/queryCommunityManagementByUser")
    public Result queryCommunityManagementByUser(Integer userNo){
        return communityManagementService.queryByUser(userNo);
    }

    @RequestMapping(value = "/queryCommunityManagementByCommunity")
    public Result queryCommunityManagementByCommunity(Integer communityNo){
        return communityManagementService.queryByCommunity(communityNo);
    }



}
